﻿<cfsilent>
	<cfscript>
		
		event.setArg("pageTitle", "教师门户 - 网上成绩提交 - 课程正考成绩");
		
		sessionAdvice = getProperty("serviceFactory").getBean("sessionAdvice");
		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		datetimeAdvice = getProperty("serviceFactory").getBean("datetimeAdvice");
		stringAdvice = getProperty("serviceFactory").getBean("stringAdvice");
		
		/* 当前教师 */
		teacherId = sessionAdvice.getAutherUserID();
		
		/* 学期参数 */
		termId = event.getArg("TermID");
		
		/* 当前时间戳 */
		dateTimeStamp = datetimeAdvice.getCurrentDatetimeString();
		
		
		/* 期末成绩提交设置 */
		sql = "SELECT date_start, date_end, time_start, time_end, institute_allowed, lease_date FROM t_mark_turn WHERE mt = 'F' ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		
		rs_mark_turn = queryObj.execute(sql = sql).getResult();


		/* 生成成绩提交任务 */
		transaction {
		
			/* 
			========================================================
				根据学生成绩记录 生成指定学期还需要提交成绩的计划任务 
			========================================================
			*/
			sql = "SELECT 
									a.term_id, a.tsk_id, a.cid, a.cidx, count(*) mark_need  
								FROM t_task a 
									INNER JOIN t_student_course b ON a.tsk_id = b.task_id 
								WHERE 
									( 
										a.tch_id = :teacherId OR a.tch_id_sec = :teacherId OR a.tch_id_ace = :teacherId 
									) 
									AND 
									SUBSTR( a.task_prop, 7, 1 ) = '0' 
									AND 
									SUBSTR( b.choose_prop, 2, 1 ) = '1' 
									AND 
									NOT EXISTS ( 
										SELECT 1 FROM t_task_mark c 
										WHERE 
											a.tsk_id = c.task_id 
											) 
								GROUP BY 
									a.term_id, a.tsk_id, a.cid, a.cidx ";

			queryObj = new Query( datasource=application.dnsMaster );
			
			queryObj.addParam( name="termId", value=termId, cfsqltype="cf_sql_char" );
			queryObj.addParam( name="teacherId", value=teacherId, cfsqltype="cf_sql_varchar" );

			rs_plan_task = queryObj.execute( sql=sql ).getResult();
			

			for( i = 1; i LTE rs_plan_task.recordCount; i++ ){
				
				/* 当前教学班号 */
				taskId = rs_plan_task['tsk_id'][i];
				/* 课程代码 */
				courseId = rs_plan_task['cid'][i];
				/* 课序号 */
				courseIdx = rs_plan_task['cidx'][i];
				/* 有效选课人数 */
				markNeed = rs_plan_task['mark_need'][i];
				/* 目标学期 */
				taskTermId = rs_plan_task['term_id'][i];


				/* 检查当前对应成绩提交任务是否已生成 */
				sql = "SELECT 1 FROM t_task_mark WHERE task_id = :taskId ";
					
				queryObj = new Query( datasource=application.dnsMaster );
				queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
					
				rs_check = queryObj.execute( sql = sql ).getResult();
					
				if ( rs_check.recordCount ) {
						
					/* 更新成绩提交任务 */
					sql = "UPDATE t_task_mark 
									SET	
										task_prog = '0', 
										mark_need = :markNeed, 
										time_unlock = :dateTimeStamp 
									WHERE 
										task_id = :taskId ";
						
					queryObj = new Query( datasource=application.dnsMaster );
					queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
					queryObj.addParam( name="dateTimeStamp", value=dateTimeStamp, cfsqltype="cf_sql_char" );
					queryObj.addParam( name="markNeed", value=markNeed, cfsqltype="cf_sql_integer" );
					
					queryObj.execute( sql=sql );
						
				}
				else {
						
					/* 新建成绩提交任务 */
					sql = "INSERT INTO t_task_mark 
									( 
										task_id, term_id, cid, cidx, task_type, task_prog, mark_done, mark_need, time_start, time_submit, time_unlock 
									) 
									VALUES 
									( 
										:taskId, :taskTermId, :courseId, :courseIdx, 'P', '0', 0, :markNeed, :dateTimeStamp, :dateTimeStamp, :dateTimeStamp 
									) ";
					
					queryObj = new Query( datasource=application.dnsMaster );
					queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
					queryObj.addParam( name="taskTermId", value=taskTermId, cfsqltype="cf_sql_char" );
					queryObj.addParam( name="courseId", value=courseId, cfsqltype="cf_sql_varchar" );
					queryObj.addParam( name="courseIdx", value=courseIdx, cfsqltype="cf_sql_char" );
					queryObj.addParam( name="markNeed", value=markNeed, cfsqltype="cf_sql_integer" );
					queryObj.addParam( name="dateTimeStamp", value=dateTimeStamp, cfsqltype="cf_sql_char" );
					
					queryObj.execute( sql=sql );
					
				}

			}
			
			
			/* 
			========================================================
				根据学生成绩记录 生成指定学期还需要提交成绩的通选课任务 
			========================================================
			*/
			sql = "SELECT 
									a.term_id, a.tsk_id, a.cid, a.cidx, count(*) mark_need  
								FROM t_common_task a 
									INNER JOIN t_student_course b ON a.tsk_id = b.task_id 
								WHERE 
									( 
										a.tch_id = :teacherId OR a.tch_id_sec = :teacherId OR a.tch_id_ace = :teacherId 
									) 
									AND 
									SUBSTR( a.task_prop, 7, 1 ) = '0' 
									AND 
									SUBSTR( b.choose_prop, 2, 1 ) = '1' 
									AND 
									NOT EXISTS ( 
										SELECT 1 FROM t_task_mark c 
										WHERE 
											a.tsk_id = c.task_id 
											) 
								GROUP BY 
									a.term_id, a.tsk_id, a.cid, a.cidx ";

			queryObj = new Query( datasource=application.dnsMaster );
			
			queryObj.addParam( name="termId", value=termId, cfsqltype="cf_sql_char" );
			queryObj.addParam( name="teacherId", value=teacherId, cfsqltype="cf_sql_varchar" );

			rs_common_task = queryObj.execute( sql=sql ).getResult();


			for( i = 1; i LTE rs_common_task.recordCount; i++ ){
				
				/* 当前教学班号 */
				taskId = rs_common_task['tsk_id'][i];
				/* 课程代码 */
				courseId = rs_common_task['cid'][i];
				/* 课序号 */
				courseIdx = rs_common_task['cidx'][i];
				/* 有效选课人数 */
				markNeed = rs_common_task['mark_need'][i];
				/* 目标学期 */
				taskTermId = rs_common_task['term_id'][i];


				/* 检查当前对应成绩提交任务是否已生成 */
				sql = "SELECT 1 FROM t_task_mark WHERE task_id = :taskId ";
					
				queryObj = new Query( datasource=application.dnsMaster );
				queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
					
				rs_check = queryObj.execute( sql = sql ).getResult();
					
				if ( rs_check.recordCount ) {
						
					/* 更新成绩提交任务 */
					sql = "UPDATE t_task_mark 
									SET	
										task_prog = '0', 
										mark_need = :markNeed, 
										time_unlock = :dateTimeStamp 
									WHERE 
										task_id = :taskId ";
						
					queryObj = new Query( datasource=application.dnsMaster );
					queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
					queryObj.addParam( name="dateTimeStamp", value=dateTimeStamp, cfsqltype="cf_sql_char" );
					queryObj.addParam( name="markNeed", value=markNeed, cfsqltype="cf_sql_integer" );
					
					queryObj.execute( sql = sql );
						
				}
				else {
						
					/* 新建成绩提交任务 */
					sql = "INSERT INTO t_task_mark 
									( 
										task_id, term_id, cid, cidx, task_type, task_prog, mark_done, mark_need, time_start, time_submit, time_unlock 
									) 
									VALUES 
									( 
										:taskId, :taskTermId, :courseId, :courseIdx, 'C', '0', 0, :markNeed, :dateTimeStamp, :dateTimeStamp, :dateTimeStamp 
									) ";
					
					queryObj = new Query( datasource=application.dnsMaster );
					queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
					queryObj.addParam( name="taskTermId", value=taskTermId, cfsqltype="cf_sql_char" );
					queryObj.addParam( name="courseId", value=courseId, cfsqltype="cf_sql_varchar" );
					queryObj.addParam( name="courseIdx", value=courseIdx, cfsqltype="cf_sql_char" );
					queryObj.addParam( name="markNeed", value=markNeed, cfsqltype="cf_sql_integer" );
					queryObj.addParam( name="dateTimeStamp", value=dateTimeStamp, cfsqltype="cf_sql_char" );
					
					queryObj.execute( sql=sql );
					
				}

			}
			
			
			/* 
			========================================================
				根据学生成绩记录 生成指定学期还需要提交成绩的单开班任务 
			========================================================
			*/
			sql = "SELECT 
									a.term_id, a.tsk_id, a.cid, a.cidx, count(*) mark_need  
								FROM t_reopen_task a 
									INNER JOIN t_student_course b ON a.tsk_id = b.task_id 
								WHERE 
									( 
										a.tch_id = :teacherId OR a.tch_id_sec = :teacherId OR a.tch_id_ace = :teacherId 
									) 
									AND 
									SUBSTR( a.task_prop, 7, 1 ) = '0' 
									AND 
									SUBSTR( b.choose_prop, 2, 1 ) = '1' 
									AND 
									NOT EXISTS ( 
										SELECT 1 FROM t_task_mark c 
										WHERE 
											a.tsk_id = c.task_id 
											) 
								GROUP BY 
									a.term_id, a.tsk_id, a.cid, a.cidx ";

			queryObj = new Query( datasource=application.dnsMaster );
			
			queryObj.addParam( name="termId", value=termId, cfsqltype="cf_sql_char" );
			queryObj.addParam( name="teacherId", value=teacherId, cfsqltype="cf_sql_varchar" );

			rs_open_task = queryObj.execute( sql=sql ).getResult();


			for( i = 1; i LTE rs_open_task.recordCount; i++ ){
				
				/* 当前教学班号 */
				taskId = rs_open_task['tsk_id'][i];
				/* 课程代码 */
				courseId = rs_open_task['cid'][i];
				/* 课序号 */
				courseIdx = rs_open_task['cidx'][i];
				/* 有效选课人数 */
				markNeed = rs_open_task['mark_need'][i];
				/* 目标学期 */
				taskTermId = rs_open_task['term_id'][i];

				/* 检查当前对应成绩提交任务是否已生成 */
				sql = "SELECT 1 FROM t_task_mark WHERE task_id = :taskId ";
					
				queryObj = new Query( datasource=application.dnsMaster );
				queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
					
				rs_check = queryObj.execute( sql = sql ).getResult();
					
				if ( rs_check.recordCount ) {
						
					/* 更新成绩提交任务 */
					sql = "UPDATE t_task_mark 
									SET	
										task_prog = '0', 
										mark_need = :markNeed, 
										time_unlock = :dateTimeStamp 
									WHERE 
										task_id = :taskId ";
						
					queryObj = new Query( datasource=application.dnsMaster );
					queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
					queryObj.addParam( name="dateTimeStamp", value=dateTimeStamp, cfsqltype="cf_sql_char" );
					queryObj.addParam( name="markNeed", value=markNeed, cfsqltype="cf_sql_integer" );
					
					queryObj.execute( sql = sql );
						
				}
				else {
						
					/* 新建成绩提交任务 */
					sql = "INSERT INTO t_task_mark 
									( 
										task_id, term_id, cid, cidx, task_type, task_prog, mark_done, mark_need, time_start, time_submit, time_unlock 
									) 
									VALUES 
									( 
										:taskId, :taskTermId, :courseId, :courseIdx, 'R', '0', 0, :markNeed, :dateTimeStamp, :dateTimeStamp, :dateTimeStamp 
									) ";
					
					queryObj = new Query( datasource=application.dnsMaster );
					queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
					queryObj.addParam( name="taskTermId", value=taskTermId, cfsqltype="cf_sql_char" );
					queryObj.addParam( name="courseId", value=courseId, cfsqltype="cf_sql_varchar" );
					queryObj.addParam( name="courseIdx", value=courseIdx, cfsqltype="cf_sql_char" );
					queryObj.addParam( name="markNeed", value=markNeed, cfsqltype="cf_sql_integer" );
					queryObj.addParam( name="dateTimeStamp", value=dateTimeStamp, cfsqltype="cf_sql_char" );
					
					queryObj.execute( sql=sql );
					
				}

			}
			
			
			/* 
			===========================================================
				根据学生成绩记录 生成指定学期还需要提交成绩的体育课教学任务 
			===========================================================
			*/
			sql = "SELECT 
									a.term_id, a.tsk_id, a.cid, a.cidx, count(*) mark_need  
								FROM t_sport_task a 
									INNER JOIN t_student_course b ON a.tsk_id = b.task_id 
								WHERE 
									( 
										a.tch_id = :teacherId OR a.tch_id_sec = :teacherId OR a.tch_id_ace = :teacherId 
									) 
									AND 
									SUBSTR( a.task_prop, 7, 1 ) = '0' 
									AND 
									SUBSTR( b.choose_prop, 2, 1 ) = '1' 
									AND 
									NOT EXISTS ( 
										SELECT 1 FROM t_task_mark c 
										WHERE 
											a.tsk_id = c.task_id 
											) 
								GROUP BY 
									a.term_id, a.tsk_id, a.cid, a.cidx ";

			queryObj = new Query( datasource=application.dnsMaster );
			
			queryObj.addParam( name="termId", value=termId, cfsqltype="cf_sql_char" );
			queryObj.addParam( name="teacherId", value=teacherId, cfsqltype="cf_sql_varchar" );

			rs_sport_task = queryObj.execute( sql=sql ).getResult();


			for( i = 1; i LTE rs_sport_task.recordCount; i++ ){
				
				/* 当前教学班号 */
				taskId = rs_sport_task['tsk_id'][i];
				/* 课程代码 */
				courseId = rs_sport_task['cid'][i];
				/* 课序号 */
				courseIdx = rs_sport_task['cidx'][i];
				/* 有效选课人数 */
				markNeed = rs_sport_task['mark_need'][i];
				/* 目标学期 */
				taskTermId = rs_sport_task['term_id'][i];


				/* 检查当前对应成绩提交任务是否已生成 */
				sql = "SELECT 1 FROM t_task_mark WHERE task_id = :taskId ";
					
				queryObj = new Query( datasource=application.dnsMaster );
				queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
					
				rs_check = queryObj.execute( sql = sql ).getResult();
					
				if ( rs_check.recordCount ) {
						
					/* 更新成绩提交任务 */
					sql = "UPDATE t_task_mark 
									SET	
										task_prog = '0', 
										mark_need = :markNeed, 
										time_unlock = :dateTimeStamp 
									WHERE 
										task_id = :taskId ";
						
					queryObj = new Query( datasource=application.dnsMaster );
					queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
					queryObj.addParam( name="dateTimeStamp", value=dateTimeStamp, cfsqltype="cf_sql_char" );
					queryObj.addParam( name="markNeed", value=markNeed, cfsqltype="cf_sql_integer" );
					
					queryObj.execute( sql = sql );
						
				}
				else {
						
					/* 新建成绩提交任务 */
					sql = "INSERT INTO t_task_mark 
									( 
										task_id, term_id, cid, cidx, task_type, task_prog, mark_done, mark_need, time_start, time_submit, time_unlock 
									) 
									VALUES 
									( 
										:taskId, :taskTermId, :courseId, :courseIdx, 'R', '0', 0, :markNeed, :dateTimeStamp, :dateTimeStamp, :dateTimeStamp 
									) ";
					
					queryObj = new Query( datasource=application.dnsMaster );
					queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
					queryObj.addParam( name="taskTermId", value=taskTermId, cfsqltype="cf_sql_char" );
					queryObj.addParam( name="courseId", value=courseId, cfsqltype="cf_sql_varchar" );
					queryObj.addParam( name="courseIdx", value=courseIdx, cfsqltype="cf_sql_char" );
					queryObj.addParam( name="markNeed", value=markNeed, cfsqltype="cf_sql_integer" );
					queryObj.addParam( name="dateTimeStamp", value=dateTimeStamp, cfsqltype="cf_sql_char" );
					
					queryObj.execute( sql=sql );
					
				}

			}

		}
		
		
		/*读取当前学期的成绩录入任务*/
		sql = "SELECT 
							a.task_id, a.task_type, a.task_prog, a.mark_done, a.mark_need, a.cidx, 
							f.course_name, f.course_credit, f.course_code, f.mark_mode, s.prop_name, 
							g.institute_short, g.institute_id 
							FROM t_task_mark a 
								INNER JOIN t_course f ON f.cid = a.cid 
								INNER JOIN t_course_prop s ON s.prop_id = f.prop_id 
								INNER JOIN t_institute g ON g.institute_id = f.institute_id 
							WHERE 
								a.term_id = :termId 
								AND 
								( 
									EXISTS ( 
										SELECT 1 FROM t_task b 
										WHERE 
											b.tsk_id = a.task_id 
											AND 
											SUBSTR( b.task_prop, 7, 1 ) = '0' 
											AND 
											( b.tch_id = :teacherId OR b.tch_id_sec = :teacherId OR b.tch_id_ace = :teacherId )
									) 
									OR 
									EXISTS ( 
										SELECT 1 FROM t_common_task c 
										WHERE 
											c.tsk_id = a.task_id 
											AND 
											SUBSTR( c.task_prop, 7, 1 ) = '0' 
											AND 
											( c.tch_id = :teacherId OR c.tch_id_sec = :teacherId OR c.tch_id_ace = :teacherId )
									) 
									OR 
									EXISTS ( 
										SELECT 1 FROM t_reopen_task d 
										WHERE 
											d.tsk_id = a.task_id 
											AND 
											SUBSTR( d.task_prop, 7, 1 ) = '0' 
											AND 
											( d.tch_id = :teacherId OR d.tch_id_sec = :teacherId OR d.tch_id_ace = :teacherId )
									) 
									OR 
									EXISTS ( 
										SELECT 1 FROM t_sport_task e 
										WHERE 
											e.tsk_id = a.task_id 
											AND 
											SUBSTR( e.task_prop, 7, 1 ) = '0' 
											AND 
											( e.tch_id = :teacherId OR e.tch_id_sec = :teacherId OR e.tch_id_ace = :teacherId )
									) 
							)
							ORDER BY a.task_type, f.course_name, a.cidx ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		queryObj.addParam( name="termId", value=termId, cfsqltype="cf_sql_char" );
		queryObj.addParam( name="teacherId", value=teacherId, cfsqltype="cf_sql_varchar" );
		
		rs_task = queryObj.execute( sql=sql ).getResult();
		
		
		/*读取所有的历史成绩录入任务*/
		sql = "SELECT 
							a.task_id, a.task_type, a.task_prog, a.mark_done, a.mark_need, a.cidx, 
							f.course_name, f.course_credit, f.course_code, f.mark_mode, 
							g.institute_short, g.institute_id 
							FROM t_task_mark a 
								INNER JOIN t_course f ON f.cid = a.cid 
								INNER JOIN t_institute g ON g.institute_id = f.institute_id 
							WHERE 
								a.term_id < :termId 
								AND 
								( 
									EXISTS ( 
										SELECT 1 FROM t_task b 
										WHERE 
											b.tsk_id = a.task_id 
											AND 
											SUBSTR( b.task_prop, 7, 1 ) = '0' 
											AND 
											( b.tch_id = :teacherId OR b.tch_id_sec = :teacherId OR b.tch_id_ace = :teacherId )
									) 
									OR 
									EXISTS ( 
										SELECT 1 FROM t_common_task c 
										WHERE 
											c.tsk_id = a.task_id 
											AND 
											SUBSTR( c.task_prop, 7, 1 ) = '0' 
											AND 
											( c.tch_id = :teacherId OR c.tch_id_sec = :teacherId OR c.tch_id_ace = :teacherId )
									) 
									OR 
									EXISTS ( 
										SELECT 1 FROM t_reopen_task d 
										WHERE 
											d.tsk_id = a.task_id 
											AND 
											SUBSTR( d.task_prop, 7, 1 ) = '0' 
											AND 
											( d.tch_id = :teacherId OR d.tch_id_sec = :teacherId OR d.tch_id_ace = :teacherId )
									) 
									OR 
									EXISTS ( 
										SELECT 1 FROM t_sport_task e 
										WHERE 
											e.tsk_id = a.task_id 
											AND 
											SUBSTR( e.task_prop, 7, 1 ) = '0' 
											AND 
											( e.tch_id = :teacherId OR e.tch_id_sec = :teacherId OR e.tch_id_ace = :teacherId )
									) 
							)
							ORDER BY a.task_type, f.course_name, a.cidx ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		
		queryObj.addParam( name="termId", value=termId, cfsqltype="cf_sql_char" );
		queryObj.addParam( name="teacherId", value=teacherId, cfsqltype="cf_sql_varchar" );

		rs_history = queryObj.execute( sql=sql ).getResult();
		
		/*读取成绩解锁申请单*/
		sql = "SELECT 
								mu.sign_id, mu.sign_status, mu.date_created, mu.sign_reason, 
								c.course_name, c.course_code 
							FROM t_task_mark_unlock mu 
								INNER JOIN t_course c ON c.cid = mu.cid 
							WHERE 
								mu.sign_user_id = :teacherId 
								AND 
								mu.term_id = :termId 
							ORDER BY 
								mu.sign_id DESC ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		
		queryObj.addParam( name="termId", value=termId, cfsqltype="cf_sql_char" );
		queryObj.addParam( name="teacherId", value=teacherId, cfsqltype="cf_sql_varchar" );
		
		rs_sign = queryObj.execute( sql=sql ).getResult();


		/* 判断当前显示课表内容 */
		currentTab = event.getArg("TabID", "labCurrent");
		
		targetArgs = structNew();
		
		currentDate = datetimeAdvice.getCurrentDateString();
		currentTime = TimeFormat(now(), "HHMM");
		
		

		if( rs_mark_turn.institute_allowed neq "ALL" ) {
			
			sql = "SELECT institute_short FROM t_institute WHERE institute_id in ( :depIds )";
			
			queryObj = new Query( datasource=application.dnsSlave );
			queryObj.addParam( name="depIds", value=rs_mark_turn.institute_allowed, cfsqltype="cf_sql_varchar", list=true );
			queryObj.addParam( name="termId", value=termId, cfsqltype="cf_sql_char" );
			
			rs_institute_allowed = queryObj.execute( sql=sql ).getResult();

		}

		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('courseTask')#</cfoutput>"><i class="mrs img btnPublish"></i><span class="uiButtonText">教学任务</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 exam"></i>需提交课程考核成绩任务
				</h2>
			</div>
		</div>
	</div>
</div>
<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labCurrent">class="active"</cfif> id="labCurrent" tabtarget="Current">课程考核成绩</span>
						<cfif rs_history.recordCount GT 0>
							<span <cfif currentTab eq "labHistory">class="active"</cfif> id="labHistory" tabtarget="History">历史课程成绩</span>
						</cfif>
						<cfif rs_sign.recordCount GT 0>
							<span <cfif currentTab eq "labRequest">class="active"</cfif> id="labRequest" tabtarget="Request">成绩更正申请</span>
						</cfif>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
				
				<div id="Current" class="tabContent">
					
					<div class="noticeBlock">
						<h3>网上成绩录入时间段安排</h3>
						<p>
							<span class="img icon16x16 message"></span>
							课程考核成绩提交
							从 
							<em><cfoutput>#datetimeAdvice.formatDateString( rs_mark_turn.date_start )#</cfoutput></em>
							至
							<em><cfoutput>#datetimeAdvice.formatDateString( rs_mark_turn.date_end )#</cfoutput></em>
								
							<cfif rs_mark_turn.time_start eq "0001" and rs_mark_turn.time_end eq "2359">
									全天
								<cfelse>
									每天
									<em><cfoutput>#datetimeAdvice.formatTimeString( rs_mark_turn.time_start, 'HH:MI')#</cfoutput> ~ <cfoutput>#datetimeAdvice.formatTimeString( rs_mark_turn.time_end, 'HH:MI')#</cfoutput></em>
							</cfif>
							.
							开课学院: 
							<cfif rs_mark_turn.institute_allowed eq "ALL">
								全部
								<cfelse>
								<cfoutput>#arrayToList( rs_institute_allowed['institute_short'], " , ")#</cfoutput>
							</cfif>
							.
							在当前学期, 您需要提交课程考核成绩的教学任务安排如下.</p>
						<hr/>
					</div>
					
					<cfif rs_task.recordCount GT 0>

							<table class="UIEditable">
								<thead>
									<tr>
										<td width="30"></td>
										<td>课程</td>
										<td width="90">课程号</td>
                                                   <td width="50">类型</td>
										<td width="50">课序号</td>                                                 
										<td width="40">学分</td>
										<td width="60">提交进度</td>
										<td width="60">计分模式</td>
										<td width="60">状态</td>
										<td width="18"></td>
                                                  <td width="18"></td>
										<td width="18"></td>
									</tr>
								</thead>
								<tbody>
									<cfset row = 0 />
                                    <cfloop query="rs_task">
										<cfset row++ />
										<cfset structInsert(targetArgs, "TSK", rs_task.task_id, true) />
										<cfset structInsert(targetArgs, "TT", rs_task.task_type, true) />
										<cfset structInsert(targetArgs, "Sign", encrypt(rs_task.task_id, teacherId, "PBEWithMD5AndDES", "Hex"), true) />
										<tr class="editRows" rowid="<cfoutput>#rs_task.task_id#</cfoutput>">
											<td class="index"><cfoutput>#row#</cfoutput></td>
											<td><cfoutput>#rs_task.course_name#</cfoutput></td>
											<td><span class="numeric"><cfoutput>#rs_task.course_code#</cfoutput></span></td>
                                                       <td><cfoutput>#rs_task.prop_name#</cfoutput></td>
											<td><span class="numeric"><cfoutput>#rs_task.cidx#</cfoutput></span></td>
											<td><span class="numeric"><cfoutput>#numberFormat(rs_task.course_credit, '_.__')#</cfoutput></span></td>
											<td align="center"><span class="numeric"><cfoutput>#rs_task.mark_done#</cfoutput> / <cfoutput>#rs_task.mark_need#</cfoutput></span></td>
											<td align="center"><cfoutput>#dictAdvice.getMarkModeName( rs_task.mark_mode )#</cfoutput></td>
											<td><cfoutput>#dictAdvice.getTaskMarkStat( rs_task.task_prog )#</cfoutput></td>
											<td>
												<cfif rs_task.task_prog eq "3">
													<a title="打印卷面成绩" href="<cfoutput>#buildURL('taskMarkPrint', targetArgs)#</cfoutput>" class="stat print" target="_blank"></a>
												</cfif>
											</td>
                                                       
                                                       <td>
												<cfif rs_task.task_prog eq "3">
													<a title="打印总评成绩" href="<cfoutput>#buildURL('taskTotalMarkPrint', targetArgs)#</cfoutput>" class="stat print" target="_blank"></a>
												</cfif>
											</td>
                                                       
                                                        <td>
												<cfif rs_task.task_prog eq "3">
													<a title="打印成绩统计结果" href="<cfoutput>#buildURL('taskMarkStatePrint', targetArgs)#</cfoutput>" class="stat print" target="_blank"></a>
												</cfif>
											</td>
                                                       
											<td>
												<!--- 判断成绩提交时段 --->
												<cfif ( rs_mark_turn.time_start lte currentTime and currentTime lte rs_mark_turn.time_end ) and ( rs_mark_turn.date_start lte currentDate and currentDate lte rs_mark_turn.date_end ) >
													<!--- 开课学院在允许的范围内 --->
													<cfif ( rs_mark_turn.institute_allowed eq "ALL" or listFind(rs_mark_turn.institute_allowed, rs_task.institute_id, ",") )>
														<cfif rs_task.task_prog eq "0" or rs_task.task_prog eq "1" or rs_task.task_prog eq "2" or rs_task.task_prog eq "4">
															<a title="提交课程成绩" href="<cfoutput>#buildURL('taskMarkHandel', targetArgs)#</cfoutput>" class="stat publish"></a>
															<cfelseif rs_task.task_prog eq "3">
															<a title="申请解锁" href="<cfoutput>#buildURL('taskMarkUnlockSign', targetArgs)#</cfoutput>" class="stat sign"></a>
														</cfif>
													</cfif>
												</cfif>
											</td>
										</tr>
									</cfloop>
								</tbody>
							</table>
							
						<cfelse>
							
							<div class="systemNotice">
								<h3>没有需要提交成绩的教学任务</h3>
							</div>
									
					</cfif>
					
				</div>
	
				<cfif rs_history.recordCount GT 0>
					
					<div id="History" class="tabContent">
					
						<div class="noticeBlock">
							<h3>历史考核成绩</h3>
							<p>
								<span class="img icon16x16 message"></span>
								下列是以往学年您参与的课程教学活动. </p>
							</p>
						</div>
						
						<table class="UIEditable">
								<thead>
									<tr>
										<td width="30"></td>
										<td>课程</td>
										<td width="90">课程号</td>
										<td width="50">课序号</td>
										<td width="40">学分</td>
										<td width="50">部门</td>
										<td width="60">提交进度</td>
										<td width="60">计分模式</td>
										<td width="60">状态</td>
										<td width="18"></td>
										<td width="18"></td>
									</tr>
								</thead>
								<tbody>
									<cfset row = 0 />
									<cfloop query="rs_history">
										<cfset row++ />
										<cfset structInsert(targetArgs, "TSK", rs_history.task_id, true) />
										<cfset structInsert(targetArgs, "TT", rs_history.task_type, true) />
										<cfset structInsert(targetArgs, "Sign", encrypt(rs_history.task_id, teacherId, "PBEWithMD5AndDES", "Hex"), true) />
										<tr class="editRows" rowid="<cfoutput>#rs_history.task_id#</cfoutput>">
											<td class="index"><cfoutput>#row#</cfoutput></td>
											<td><cfoutput>#rs_history.course_name#</cfoutput></td>
											<td><span class="numeric"><cfoutput>#rs_history.course_code#</cfoutput></span></td>
											<td><span class="numeric"><cfoutput>#rs_history.cidx#</cfoutput></span></td>
											<td><span class="numeric"><cfoutput>#numberFormat(rs_history.course_credit, '_.__')#</cfoutput></span></td>
											<td><cfoutput>#rs_history.institute_short#</cfoutput></td>
											<td align="center"><span class="numeric"><cfoutput>#rs_history.mark_done#</cfoutput> / <cfoutput>#rs_history.mark_need#</cfoutput></span></td>
											<td align="center"><cfoutput>#dictAdvice.getMarkModeName( rs_history.mark_mode )#</cfoutput></td>
											<td><cfoutput>#dictAdvice.getTaskMarkStat( rs_history.task_prog )#</cfoutput></td>
											<td>
												<cfif rs_history.task_prog eq "3">
													<a title="打印课程成绩" href="<cfoutput>#buildURL('taskMarkPrint', targetArgs)#</cfoutput>" class="stat print" target="_blank"></a>
												</cfif>
											</td>
											<td>
												<!--- 判断成绩提交时段 --->
												<cfif (rs_history.task_prog neq "3") and ( rs_mark_turn.time_start lte currentTime and currentTime lte rs_mark_turn.time_end ) and ( rs_mark_turn.date_start lte currentDate and currentDate lte rs_mark_turn.date_end ) >
													<!--- 开课学院在允许的范围内 --->
													<cfif ( rs_mark_turn.institute_allowed eq "ALL" or listFind(rs_mark_turn.institute_allowed, rs_history.institute_id, ",") )>
														<a title="提交课程成绩" href="<cfoutput>#buildURL('taskMarkHandel', targetArgs)#</cfoutput>" class="stat publish"></a>
													</cfif>
												</cfif>
											</td>
										</tr>
									</cfloop>
								</tbody>
							</table>
						
					</div>
				
				</cfif>
				
				<cfif rs_sign.recordCount GT 0>
					
					<div id="Request" class="tabContent">
						
						<div class="noticeBlock">
							<h3>成绩修改申请 历史记录</h3>
							<hr/>
						</div>
						
						<cfset row = 0 />
						<table class="UIEditable">
							<thead>
								<tr>
									<td width="18"></td>
									<td>课程</td>
									<td width="90">课程号</td>
									<td>修订原因</td>
									<td width="60">审批进程</td>
									<td width="70">申请时间</td>
								</tr>
							</thead>
							<tbody>
								<cfloop query="rs_sign">
									<cfset row ++ />
									<tr class="editRows <cfif event.getArg('REQ') eq rs_sign.sign_id> lastEdited</cfif>">
										<td><span class="index"><cfoutput>#row#</cfoutput></span></td>
										<td nowrap="nowrap"><cfoutput>#rs_sign.course_name#</cfoutput></td>
										<td><span class="numeric"><cfoutput>#rs_sign.course_code#</cfoutput></span></td>
										<td><cfoutput>#stringAdvice.XHTMLSafeFormat( rs_sign.sign_reason )#</cfoutput></td>
										<td><cfoutput>#dictAdvice.getProgressStatus( rs_sign.sign_status )#</cfoutput></td>
										<td><span class="numeric"><cfoutput>#datetimeAdvice.formatDateString( rs_sign.date_created, "YYYY/MM/DD" )#</cfoutput></span></td>
									</tr>
								</cfloop>
							</tbody>
						</table>
					</div>
					
				</cfif>
				
			</div>
		</li>
	</ul>
</div>


